package com.example.oppotest.controller;

import com.example.oppotest.service.OppoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/oppo")
public class OppoController extends BaseController{

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private OppoService oppoService;

    @RequestMapping(value = "/test", method = RequestMethod.GET)
    @ResponseBody
    public ModelMap test(HttpServletRequest request) {
        ModelMap map = new ModelMap();
        map.put("code", 0);
        return map;
    }

    @RequestMapping(value = "/getConfigList", method = RequestMethod.GET)
    @ResponseBody
    public ModelMap getConfigList(HttpServletRequest request) throws Exception {
        ModelMap map = oppoService.getConfigList();
        return map;
    }

    @RequestMapping(value = "/getPlan", method = RequestMethod.GET)
    @ResponseBody
    public ModelMap getPlan(HttpServletRequest request) throws Exception {
        ModelMap map = oppoService.getPlan();
        return map;
    }

    @RequestMapping(value = "/updatePlanStatus", method = RequestMethod.GET)
    @ResponseBody
    public ModelMap updatePlanStatus(HttpServletRequest request) throws Exception {
        ModelMap map = oppoService.updatePlanStatus();
        return map;
    }

}
